﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

public partial class DemoGridView_AddProduct : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            LoadDropList();
    }

    private void LoadDropList()
    {
        SqlDataAdapter da = new SqlDataAdapter("select * from Origin", DataAccess.ConnectionString);
        DataSet ds = new DataSet();
        da.Fill(ds, "Origin");
        DropDownList1.DataSource = ds.Tables["Origin"];
        DropDownList1.DataTextField = "OriginName";
        DropDownList1.DataValueField = "OriginId";
        DropDownList1.DataBind();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Write(DropDownList1.SelectedValue);
    }
}
